﻿using System;

namespace ConsoleLearn
{
    class Pat
    {
        public string name = "pat";
        public void say()
        {
            Console.WriteLine("patName:"+name);
        }
    }

    class Cat : Pat
    {
        new public string name = "cat";
        public new void say()
        {
            Console.WriteLine("catName:" + name);
        }
    }


    class Program
    {
        /* 使用out改变a的值 */
        static int exchange(out int a)
        {
            a = 100;
            return a;
        }
        /*
        static void Main(string[] args)
        {
            /*
            Pat pat = new Pat();
            pat.say();
            Console.WriteLine(pat.name);
            Cat cat = new Cat();
            cat.say();
            Console.WriteLine(cat.name);
            Pat p1 = new Cat();
            p1.say();
            Console.ReadKey();
            */
            /*
            string s = "123";
            int res = 9;
            if (int.TryParse(s, out res))
            {
                Console.WriteLine("转换成功:" + res);//123
            }
            else
            {
                Console.WriteLine("转换失败:" + res);//9
            }

            int abc = 10;
            Console.WriteLine(abc);
            Console.WriteLine(exchange(out abc));
            Console.WriteLine(abc);

            Console.ReadKey();
        }
        */
    }
}
